/**
 * 
 */
package com.sci.web.action.register;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.dao.UserRegisterDao;

/**
 * @author  BaiFuyou
 * @date: Oct 13, 2011 10:18:15 AM
 *在编辑的时候检测企业名称是否被占用
 */
public class IsEnterpriseNameExistForEditAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4288503222880893819L;
	/**
	 * 传递进的用户ID
	 */
	private int userId ;
	/**
	 * 传进的企业名称
	 */
	private String name;
	@Resource
	private UserRegisterDao registerdao;
	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}
	/**
	 * @param userId the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		super.setContentType(super.JSON);
		if(registerdao.isEnterpriseNameExistForEdit(userId, name)){
			outPrint("ok");
		}else{
			outPrint("fail");
		}
		return "json";
	}

}
